//
//  QHomeOrderViewModel.m
//  QMCXDriver
//
//  Created by Massimo on 2017/4/13.
//  Copyright © 2017年 Massimo. All rights reserved.
//

#import "QHomeOrderViewModel.h"

@interface QHomeOrderViewModel()
@property (nonatomic, copy)QHomeOrderAccept acceptBlock;
@property (nonatomic, copy)QHomeOrderReject rejectBlock;

@end


@implementation QHomeOrderViewModel

- (instancetype)initWithModel:(id)model{
    self = [super init];
    if (self) {
        
    }
    return self;
}
- (void)setAcceptCallBack:(QHomeOrderAccept)callback{
    _acceptBlock = callback;
}
- (void)setRejectCallBack:(QHomeOrderReject)callback{
    _rejectBlock = callback;
}

- (void)modelWith:(QHomeOrderTableViewCell *)cell{
    
    [cell setRejectCallBack:_rejectBlock];
    [cell setAcceptCallBack:_acceptBlock];
    
    switch (self.orderType) {
        case OrderType_baoche:
            
            cell.typeImageView.image = [UIImage imageNamed:@"icon_home_baoche"];
            cell.typeLabel.text = @"包车";
            break;
        case OrderType_yueche:
            cell.typeImageView.image = [UIImage imageNamed:@"icon_home_yueche"];
            cell.typeLabel.text = @"约车";
            break;
        default:
            
            break;
    }
}

- (UIViewController*)nextViewController{
    NSString *storyBoardName = nil;
    
    switch (self.orderType) {
        case OrderType_baoche:
            storyBoardName = @"BaoChe";
            break;
        case OrderType_yueche:
            storyBoardName = @"YueChe";
            break;
        default:
            return nil;
            break;
    }
    
    UIViewController *vc = [[UIStoryboard storyboardWithName:storyBoardName bundle:nil] instantiateInitialViewController];
    return vc;
}

@end
